public class  LoanCalculator {
    private int a;
    private  int m;
    private double y;
    private double avgInterest;
    private double avgCap;
    public LoanCalculator(int a,int m,double y){
        this.a=a;
        this.m=m;
        this.y=y;
    }
    public void calculateAvgInterest(){
        avgInterest = (m+1)*a*(y/12)/2;
        print(1);
    }
    public void calculateAvgCap(){
        double x = Math.pow(1+(y/12),m);
        avgCap = m*a*(y/12)*x/(x-1)-a;
        print(2);
    }
    public void print(int type){
        if(type == 1)
            System.out.println("AVGINT:" +avgInterest);
        if(type == 2)
            System.out.println("AVGCAP:" +avgCap);
    }
}
